<?php
require_once dirname(__FILE__).'/database.class.php';
$db=new stdb();

class user{
    public $id;
    public $name;
    public $hash;
    public $tip;
    public $Nume;
    public $Prenume;
    public $facultatea;
    public $an;
    public $specialitatea;
    public $tel;
       
}

class user_func extends user{
    
    public function user_func($id=0,$name=0,$hash=0,$tip=1)
    {
        $this->id=$id;
        $this->name=$name;
        $this->hash=$hash;
        $this->tip=$tip;
    }
    
    public function preia_detalii($user_id)
    {
        global $db;
        $result = $db->q("Select * from detalii_utilizatori Where ID = $user_id ");
        if(!$result)
            return 0;
        else
        {
            $row = mysql_fetch_array($result);
            $this->Nume = $row[1];
            $this->Prenume = $row[2];
            $this->facultatea = $row[3];
            $this->an = $row[4];
            $this->specialitatea = $row[5];
        }
        $result = $db->q("Select telefon from carte_telefon Where user_id = $user_id ");
        if(!$result)
            return 0;
        else
        {
            $row = mysql_fetch_array($result);
            $this->tel = $row[0];    
        }   
        
        $result = $db->q("Select * from utilizatori Where ID = $user_id ");
        if(!$result)
            return 0;
        else
        {
            $row = mysql_fetch_array($result);
            $this->name = $row[1];
            $this->hash = $row[2];
            $this->tip = $row[3];
         }
        return 1;
    }
    public function afiseaza_informatii()
    {
        $val = "Username: $this->name <br/>";
        $val.= "Numele: $this->Nume $this->Prenume <br/>";
        $val.= "Facultatea: $this->facultatea <br/>";
        $val.= "Anul: $this->an <br/>";
        $val.= "Specialitatea: $this->specialitatea <br/>";
        $val.= "Numar de telefon: $this->tel <br/>";
        return $val;
    }
    
    public function select_tag($path)
    {//./../modifica_un_camp.php
        $schimb='<form action="'.$path.'" method=post>';
        $schimb.='<select name="campul"  >
            <option value=""></option>
            <option value="username">Username</option>
            <option value="parola">Parola</option>
            <option value="Nume">Nume</option>
            <option value="Prenume">Prenume</option>
            <option value="Facultate">Facultatea</option>
            <option value="An">Anul</option>
            <option value="Specialitatea">Specialitatea</option>
            <option value="telefon">Numarul de telefon</option>
            </select>';
        
        $schimb.='<input type="text" name="nou" value=""/>
            <a href="#" class="grey-button pcb"><span><input type="Submit" value="Modifica"></input></span></a> <br/> <br/>  
            </form>';

        return $schimb;    
    }
    
   
    
}


 ?>   